package com.rlyy.interceptor;

import com.rlyy.basic.support.IRequestInterceptionProcessor;
import com.rlyy.common.param.Request;
import com.rlyy.common.response.Result;
import org.springframework.stereotype.Component;

/**
 * 拦截请求
 *
 * @author yuanqinglong
 * @since 2021/9/18 14:07
 */
@Component
public class RequestInterceptor implements IRequestInterceptionProcessor {


    /**
     * 请求之前执行
     *
     * @param grpcRequest grpc请求
     * @throws Exception 异常
     */
    @Override
    public void beforeHandler(Request grpcRequest) throws Exception {
        //System.out.println("请求信息：" + grpcRequest.toString());
    }


    /**
     * 处理请求后执行
     *
     * @param grpcRequest grpc请求
     * @param result      结果
     * @throws Exception 异常
     */
    @Override
    public void postHandler(Request grpcRequest, Result result) throws Exception {

        //System.out.println("返回信息：" + JSONObject.toJSONString(result));
    }
}
